//
//  loadView.m
//  加载动画
//
//  Created by rimi on 16/3/17.
//  Copyright © 2016年 com.ruifeng. All rights reserved.
//

#import "loadView.h"

@implementation loadView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setView];
            }
    return self;
}
- (void)setView{
    self.loadImage = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height)];
    self.loadImage.image = [UIImage imageNamed:@"加载"];
    [self addSubview:self.loadImage];

    self.image = [[UIImageView alloc]init];
    _image.bounds = CGRectMake(0, 0, self.bounds.size.width*0.7, self.bounds.size.width*0.7/110*114);
    _image.center = _loadImage.center;
    _image.image = [UIImage imageNamed:@"place"];
    [self addSubview:_image];
    
    CABasicAnimation *ratationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
    ratationAnimation.duration = 3;
    ratationAnimation.toValue = @(-5*2*M_PI);
    ratationAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
    [self.loadImage.layer addAnimation:ratationAnimation forKey:@"transform.rotation"];

}

@end
